package com.dingup.homework.dao;


import com.dingup.homework.bean.DO.HwHomeworkRecordDO;
import com.dingup.homework.bean.DTO.HomeworkProgressDTO;
import com.dingup.homework.bean.DTO.HomeworkRecordDODataMapInfo;
import org.apache.ibatis.annotations.Param;

import java.util.HashMap;
import java.util.List;

import static com.dingup.homework.util.ConstUtil.KEY_HOMEWORK_ID;
import static com.dingup.homework.util.ConstUtil.KEY_STUDENT_ID;

/**
 * @author jun 2018/11/16
 */
public interface HwHomeworkRecordsMapper {
    Boolean add(HwHomeworkRecordDO homeworkRecord);

    Boolean update(HwHomeworkRecordDO homeworkRecord);

    HomeworkRecordDODataMapInfo getById(Integer id);

    List<HomeworkRecordDODataMapInfo> listByStudentId(String userId);

    List<HomeworkRecordDODataMapInfo> listByUserIds(HashMap<String, Object> param);

    List<String> getStudentIdsByHomeworkId(Integer homeworkId);

    /**
     * 检查是否存在某条记录
     *
     * @param homeworkId Integer
     * @param studentId  String
     * @return Boolean
     */
    Boolean exist(@Param(KEY_HOMEWORK_ID) Integer homeworkId,
                  @Param(KEY_STUDENT_ID) String studentId);

    /**
     * 通过homeworkId获取全部学生记录数据
     *
     * @param homeworkId Integer
     * @return List<HwHomeworkRecordDO>
     */
    List<HomeworkRecordDODataMapInfo> listByHomeworkId(Integer homeworkId);

    /**
     * User: jun
     * Date: 2017/12/15
     * Desc: 获取符合推送单次作业报告的数据
     */
    List<HwHomeworkRecordDO> getList4WeekReport();

    List<HwHomeworkRecordDO> getHomeworkSortResult(Integer homeworkId);

    HwHomeworkRecordDO getByHomeworkAndStudent(@Param(KEY_HOMEWORK_ID) Integer homeworkId,
                                               @Param(KEY_STUDENT_ID) String studentId);

    Boolean updateHomeworkValid(@Param("id") Integer id, @Param("ifValidForStudent") Integer ifValidForStudent, @Param("ifValidForTeacher") Integer ifValidForTeacher);

    List<HwHomeworkRecordDO> getByCreateTeacherId(String teacherId);

    /**
     * 获取作业进度
     *
     * @param homeworkId Integer
     * @return List<HomeworkProgressDTO>
     */
    List<HomeworkProgressDTO> listProgress(Integer homeworkId);

    List<HwHomeworkRecordDO> getByHomeworkId(Integer homeworkId);
}
